<template>
    <div class="app-container calendar-list-container">
       <el-form :model="form" :rules="rules" ref="form" label-width="100px">
            <el-form-item label="店铺索引id" prop="storeId">
                <el-input v-model="form.storeId" placeholder="店铺索引id" :disabled="true" value="scope.row.storeId"></el-input>
            </el-form-item>
            <el-form-item label="店铺名称" prop="storeName">
                <el-input v-model="form.storeName" placeholder="店铺名称" :disabled="true"></el-input>
            </el-form-item>
                    <el-form-item label="店铺认证" prop="storeAuth">
                        <el-input v-model="form.storeAuth" placeholder="店铺认证,0-未认证，1-认证" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="店铺认证,0-未认证，1-认证" prop="username">
                        <el-input v-model="form.storeAuth" placeholder="店铺认证,0-未认证，1-认证"></el-input>
                    </el-form-item> -->
                    <!-- <el-form-item label="店主认证，0-未认证，1-认证" prop="username">
                        <el-input v-model="form.ownerAuth" placeholder="店主认证，0-未认证，1-认证"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺等级" prop="username">
                        <el-input v-model="form.gradeId" placeholder="店铺等级"></el-input>
                    </el-form-item> -->
                    <!-- <el-form-item label="会员id" prop="username">
                        <el-input v-model="form.userId" placeholder="会员id"></el-input>
                    </el-form-item>
                    <el-form-item label="会员名称" prop="username">
                        <el-input v-model="form.userName" placeholder="会员名称"></el-input>
                    </el-form-item>
                    <el-form-item label="身份证" prop="username">
                        <el-input v-model="form.storeOwnerCard" placeholder="身份证"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺分类" prop="username">
                        <el-input v-model="form.scId" placeholder="店铺分类"></el-input>
                    </el-form-item> -->
                    <el-form-item label="地区id" prop="areaId">
                        <el-input v-model="form.areaId" placeholder="地区id" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="地区内容，冗余数据" prop="username">
                        <el-input v-model="form.areaInfo" placeholder="地区内容，冗余数据"></el-input>
                    </el-form-item> -->
                    <el-form-item label="详细地区" prop="storeAddress">
                        <el-input v-model="form.storeAddress" placeholder="详细地区" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="邮政编码" prop="username">
                        <el-input v-model="form.storeZip" placeholder="邮政编码"></el-input>
                    </el-form-item>
                    <el-form-item label="电话号码" prop="username">
                        <el-input v-model="form.storeTel" placeholder="电话号码"></el-input>
                    </el-form-item>
                    <el-form-item label="短信接口字段" prop="username">
                        <el-input v-model="form.storeSms" placeholder="短信接口字段"></el-input>
                    </el-form-item>
                    <el-form-item label="证件上传" prop="username">
                        <el-input v-model="form.storeImage" placeholder="证件上传"></el-input>
                    </el-form-item>
                    <el-form-item label="执照上传" prop="username">
                        <el-input v-model="form.storeImage1" placeholder="执照上传"></el-input>
                    </el-form-item> 
                    <el-form-item label="店铺状态，0关闭，1开启，2审核中" prop="username">
                        <el-input v-model="form.storeState" placeholder="店铺状态，0关闭，1开启，2审核中"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺关闭原因" prop="username">
                        <el-input v-model="form.storeCloseInfo" placeholder="店铺关闭原因"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺排序" prop="username">
                        <el-input v-model="form.storeSort" placeholder="店铺排序"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺时间" prop="username">
                        <el-input v-model="form.storeTime" placeholder="店铺时间"></el-input>
                    </el-form-item>
                    <el-form-item label="" prop="username">
                        <el-input v-model="form.endTime" placeholder=""></el-input>
                    </el-form-item>-->
                    <!-- <el-form-item label="店铺logo" prop="storeLabel">
                        <el-input v-model="form.storeLabel" placeholder="店铺logo"></el-input>
                    </el-form-item> -->
                    <!-- <el-form-item label="店铺门脸照" prop="username">
                        <el-input v-model="form.storeBanner" placeholder="店铺门脸照"></el-input>
                    </el-form-item> -->
                    <el-form-item label="店铺logo" prop="storeLogo">
                        <el-input v-model="form.storeLogo" placeholder="店铺logo" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="店铺seo关键字" prop="username">
                        <el-input v-model="form.storeKeywords" placeholder="店铺seo关键字"></el-input>
                    </el-form-item> -->
                    <el-form-item label="店铺展示视频" prop="storeDisplayVideo">
                        <el-input v-model="form.storeDisplayVideo" placeholder="店铺展示视频" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="店铺seo描述" prop="username">
                        <el-input v-model="form.storeDescription" placeholder="店铺seo描述"></el-input>
                    </el-form-item>
                    <el-form-item label="QQ" prop="username">
                        <el-input v-model="form.storeQq" placeholder="QQ"></el-input>
                    </el-form-item>
                    <el-form-item label="阿里旺旺" prop="username">
                        <el-input v-model="form.storeWw" placeholder="阿里旺旺"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺简介" prop="username">
                        <el-input v-model="form.description" placeholder="店铺简介"></el-input>
                    </el-form-item>
                    <el-form-item label="主营商品" prop="username">
                        <el-input v-model="form.storeMainGoods" placeholder="主营商品"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺二级域名" prop="username">
                        <el-input v-model="form.storeDomain" placeholder="店铺二级域名"></el-input>
                    </el-form-item>
                    <el-form-item label="二级域名修改次数" prop="username">
                        <el-input v-model="form.storeDomainTimes" placeholder="二级域名修改次数"></el-input>
                    </el-form-item>
                    <el-form-item label="推荐，0为否，1为是，默认为0" prop="username">
                        <el-input v-model="form.storeRecommend" placeholder="推荐，0为否，1为是，默认为0"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺当前主题" prop="username">
                        <el-input v-model="form.storeTheme" placeholder="店铺当前主题"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺信用" prop="username">
                        <el-input v-model="form.storeCredit" placeholder="店铺信用"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺好评率" prop="username">
                        <el-input v-model="form.praiseRate" placeholder="店铺好评率"></el-input>
                    </el-form-item>
                    <el-form-item label="是否删除，0否，1是" prop="username">
                        <el-input v-model="form.isDel" placeholder="是否删除，0否，1是"></el-input>
                    </el-form-item>
                    <el-form-item label="描述相符度分数" prop="username">
                        <el-input v-model="form.storeDesccredit" placeholder="描述相符度分数"></el-input>
                    </el-form-item>
                    <el-form-item label="服务态度分数" prop="username">
                        <el-input v-model="form.storeServicecredit" placeholder="服务态度分数"></el-input>
                    </el-form-item>
                    <el-form-item label="发货速度分数" prop="username">
                        <el-input v-model="form.storeDeliverycredit" placeholder="发货速度分数"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺二维码" prop="username">
                        <el-input v-model="form.storeCode" placeholder="店铺二维码"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺收藏数量" prop="username">
                        <el-input v-model="form.storeCollect" placeholder="店铺收藏数量"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺幻灯片" prop="username">
                        <el-input v-model="form.storeSlide" placeholder="店铺幻灯片"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺幻灯片链接" prop="username">
                        <el-input v-model="form.storeSlideUrl" placeholder="店铺幻灯片链接"></el-input>
                    </el-form-item>
                    <el-form-item label="卖家中心的常用操作快捷链接" prop="username">
                        <el-input v-model="form.storeCenterQuicklink" placeholder="卖家中心的常用操作快捷链接"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺印章" prop="username">
                        <el-input v-model="form.storeStamp" placeholder="店铺印章"></el-input>
                    </el-form-item>
                    <el-form-item label="打印订单页面下方说明文字" prop="username">
                        <el-input v-model="form.storePrintdesc" placeholder="打印订单页面下方说明文字"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺销量" prop="username">
                        <el-input v-model="form.storeSales" placeholder="店铺销量"></el-input>
                    </el-form-item>
                    <el-form-item label="售前客服" prop="username">
                        <el-input v-model="form.storePresales" placeholder="售前客服"></el-input>
                    </el-form-item>
                    <el-form-item label="售后客服" prop="username">
                        <el-input v-model="form.storeAftersales" placeholder="售后客服"></el-input>
                    </el-form-item>
                    <el-form-item label="工作时间" prop="username">
                        <el-input v-model="form.storeWorkingtime" placeholder="工作时间"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺坐在市id" prop="username">
                        <el-input v-model="form.cityId" placeholder="店铺坐在市id"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺所在地（省）" prop="username">
                        <el-input v-model="form.provinceId" placeholder="店铺所在地（省）"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺点击量" prop="username">
                        <el-input v-model="form.storeClick" placeholder="店铺点击量"></el-input>
                    </el-form-item>
                    <el-form-item label="" prop="username">
                        <el-input v-model="form.storecreateTime" placeholder=""></el-input>
                    </el-form-item>
                    <el-form-item label="当前登陆时间" prop="username">
                        <el-input v-model="form.storeLogintime" placeholder="当前登陆时间"></el-input>
                    </el-form-item>
                    <el-form-item label="上次登陆时间" prop="username">

                        <el-input v-model="form.storeLastlogintime" placeholder="上次登陆时间"></el-input>
                    </el-form-item>
                    <el-form-item label="经度" prop="username">
                        <el-input v-model="form.storeLongitude" placeholder="经度"></el-input>
                    </el-form-item>
                    <el-form-item label="纬度" prop="username">
                        <el-input v-model="form.storeAtitude" placeholder="纬度"></el-input>
                    </el-form-item>
                    <el-form-item label="银行开户名" prop="username">
                        <el-input v-model="form.bankAccountName" placeholder="银行开户名"></el-input>
                    </el-form-item>
                    <el-form-item label="公司银行账号" prop="username">
                        <el-input v-model="form.bankAccountNumber" placeholder="公司银行账号"></el-input>
                    </el-form-item>
                    <el-form-item label="开户银行支行名称" prop="username">
                        <el-input v-model="form.bankName" placeholder="开户银行支行名称"></el-input>
                    </el-form-item>
                    <el-form-item label="支行联行号" prop="username">
                        <el-input v-model="form.bankCode" placeholder="支行联行号"></el-input>
                    </el-form-item>
                    <el-form-item label="支付宝姓名" prop="username">
                        <el-input v-model="form.alipayName" placeholder="支付宝姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="支付宝账号名" prop="username">
                        <el-input v-model="form.alipayAccountNumber" placeholder="支付宝账号名"></el-input>
                    </el-form-item>
                    <el-form-item label="微信姓名" prop="username">
                        <el-input v-model="form.weichatName" placeholder="微信姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="微信账号" prop="username">
                        <el-input v-model="form.weichatAccountNumber" placeholder="微信账号"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺类型ID" prop="username">
                        <el-input v-model="form.typeId" placeholder="店铺类型ID"></el-input>
                    </el-form-item>
                    <el-form-item label="店铺类型名称" prop="username">
                        <el-input v-model="form.typeName" placeholder="店铺类型名称"></el-input>
                    </el-form-item> -->
                    <el-form-item label="地区code" prop="areaCode">
                        <el-input v-model="form.areaCode" placeholder="地区code" :disabled="true"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="" prop="username">
                        <el-input v-model="form.areaDetail" placeholder=""></el-input>
                    </el-form-item> -->
                   
                    <el-form-item>
                        <el-button  type="warning">审核  </el-button>
                        <el-button  type="danger" @click="handleUpdate(scope.row)"> 退回  </el-button>
                    </el-form-item>
        </el-form>
    </div>
</template>

<script>
import {
  fetchList,
  addObj,
  putObj,
  getObj,
  delObj
} from "@/api/modules/shop/shop_store";
import waves from "@/directive/waves/index.js"; // 水波纹指令
import { mapGetters } from "vuex";
import request from "@/router/axios";

export default {
  name: "table_auditing",
  directives: {
    waves
  },
  data() {
    return {
      list: null,
      total: null,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20
      },
      rules: {},
      form: {
        storeId: undefined,
        storeName: undefined,
        storeAuth: undefined,
        areaId: undefined,
        storeAddress: undefined,
        storeLogo: undefined,
        storeDisplayVideo: undefined,
        areaCode: undefined
      },
      dialogFormVisible: false,
      dialogStatus: "",
      shop_store_add: false,
      shop_store_upd: false,
      shop_store_del: false,
      textMap: {
        update: "编辑",
        create: "创建"
      },
      tableKey: 0
    };
  },

  computed: {
    ...mapGetters(["permissions"])
  },
  filters: {
    statusFilter(status) {
      const statusMap = {
        0: "有效",
        1: "无效"
      };
      return statusMap[status];
    }
  },

  created() {
    this.getList();
    this.shop_store_add = this.permissions["shop_store_add"];
    this.shop_store_upd = this.permissions["shop_store_upd"];
    this.shop_store_del = this.permissions["shop_store_del"];
  },
  methods: {
    getList() {
      this.listLoading = true;
      this.listQuery.isAsc = false;
      fetchList(this.listQuery).then(response => {
        this.list = response.data.records;
        this.total = response.data.total;
        this.listLoading = false;
      });
    },

    handleSizeChange(val) {
      this.listQuery.limit = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.listQuery.page = val;
      this.getList();
    },
    handleDelete(row) {
      delObj(row.id).then(response => {
        this.dialogFormVisible = false;
        this.getList();
        this.$notify({
          title: "成功",
          message: "删除成功",
          type: "success",
          duration: 2000
        });
      });
    },

    handleCreate() {
      this.dialogStatus = "create";
      this.dialogFormVisible = true;
    },
    handleUpdate(row) {
      getObj(row.id).then(response => {
        this.form = response.data;
        this.dialogFormVisible = true;
        this.dialogStatus = "update";
        // this.role = [];
        this.form.storeId = row.storeId;
        this.form.storeName = row.storeName;
        this.form.storeAuth = row.storeAuth;
        this.form.areaId = row.areaId;
        this.form.storeAddress = row.storeAddress;
        this.form.storeLogo = row.storeLogo;
        this.form.storeDisplayVideo = row.storeDisplayVideo;
        this.form.areaCode = row.areaCode;
      });
    },

    //  deletes(row) {
    //       this.$confirm(
    //         "此操作将永久删除该用户(用户名:" + row.username + "), 是否继续?",
    //         "提示",
    //         {
    //           confirmButtonText: "确定",
    //           cancelButtonText: "取消",
    //           type: "warning"
    //         }
    //       ).then(() => {
    //         delObj(row.userId)
    //           .then(() => {
    //             this.getList();
    //             this.$notify({
    //               title: "成功",
    //               message: "删除成功",
    //               type: "success",
    //               duration: 2000
    //             });
    //           })
    //           .cache(() => {
    //             this.$notify({
    //               title: "失败",
    //               message: "删除失败",
    //               type: "error",
    //               duration: 2000
    //             });
    //           });
    //       });
    //     },

    create(formName) {
      const set = this.$refs;
      set[formName].validate(valid => {
        if (valid) {
          addObj(this.form).then(() => {
            this.dialogFormVisible = false;
            this.getList();
            this.$notify({
              title: "成功",
              message: "创建成功",
              type: "success",
              duration: 2000
            });
          });
        } else {
          return false;
        }
      });
    },
    cancel(formName) {
      this.dialogFormVisible = false;
      const set = this.$refs;
      set[formName].resetFields();
    },
    update(formName) {
      const set = this.$refs;
      this.form.role = this.role;
      set[formName].validate(valid => {
        if (valid) {
          this.dialogFormVisible = false;
          this.form.password = undefined;
          putObj(this.form).then(() => {
            this.dialogFormVisible = false;
            this.getList();
            this.$notify({
              title: "成功",
              message: "修改成功",
              type: "success",
              duration: 2000
            });
          });
        } else {
          return false;
        }
      });
    },
    resetTemp() {
      this.form = {
        id: undefined,
        role: [],
        delFlag: "",
        deptId: "",
        phone: ""
      };
    }
  }
};
</script>
